package com.jiaozi.core.controller;

import com.jiaozi.base.utils.bean.R;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@Hidden
public class FilterErrorController {
    /**
     * 专门用于捕捉过滤器传递来的异常，并重新抛出异常
     */
    @RequestMapping("/exception")
    public R exception(HttpServletRequest request) throws Exception {
        throw (Exception) request.getAttribute("exception");
    }
}
